<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../../../common/taglib.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>会员汇款审核</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<link href="${ctx }/css/style.css" type="text/css" rel="stylesheet" />
		<link href="${ctx }/css/page.css" type="text/css" rel="stylesheet" />
		<script type="text/javascript" src="${ctx }/js/jquery/jquery-1.6.1.min.js"></script>
		<script type="text/javascript">
			$(function() {
				$("#approveState").change(function() {
					$("form:first").submit();
				});

				$("#btnSelectAll").click(function() {
					$("input[name=postids]").each(function() {
						 $(this).attr("checked", !this.checked);      
					});
				});

				$("#btnPass").click(function() {
					var size = $("input[name=postids]:checked").size();

					if (size == 0) {
						alert("请选择要审核通过的汇款记录！");
						return;
					}

					var form = $("form:first");
					form.attr("action", "${ctx}/post/approvePass.action");
					form.submit();

					form.attr("action", "${ctx}/post/listAllPostHistory.action");
				});

				$("#btnUntread").click(function() {
					var size = $("input[name=postids]:checked").size();

					if (size == 0) {
						alert("请选择要退回的汇款记录！");
						return;
					}

					if (confirm('确认要退回所选汇款记录么？')) {
						var form = $("form:first");
						form.attr("action", "${ctx}/post/approveRefuse.action");
						form.submit();

						form.attr("action", "${ctx}/post/listAllPostHistory.action");
					}
				});

				$("#btnDelete").click(function() {
					var size = $("input[name=postids]:checked").size();

					if (size == 0) {
						alert("请选择要删除的汇款记录！");
						return;
					}

					if (confirm('确认要删除所选汇款记录么？')) {
						var form = $("form:first");
						form.attr("action", "${ctx}/post/removePostHistory.action");
						form.submit();

						form.attr("action", "${ctx}/post/listAllPostHistory.action");
					}
				});
			});
				
			viewPostDetail = function(id) {
				window.showModalDialog("${ctx}/post/viewPostHistoryDetail.action?historyId=" + id,"","status=no;dialogWidth=380px;dialogHeight=450px;menu=no;resizeable=yes;scroll=yes;center=yes;edge=raise");
			}
		</script>
	</head>

	<body>
		<s:form id="form1" action="listAllPostHistory" method="post" namespace="/post">
			<div>
				<div style="width: 100%; height: 30px; text-align: left;">
					当前位置：会员汇款审核
				</div>
				<div style="width: 100%; background-color: #EDDEA0; height: 30px; border: 1px solid gray; text-align: center;">
					<b>会 员 汇 款 审 核</b>
				</div>

				<div style="width: 100%; background-color: #EDDEA0; height: 39px; border: 1px solid gray; text-align: center;">
					<div style="float: left; width: 12%; padding-top: 6px">
						<input type="checkbox" id="btnSelectAll" />
						全选
					</div>
					<div style="float: left; padding-top: 6px;">
						<span>汇款信息选择：</span>
						<s:select id="approveState" list="#{-1:'所有汇款记录', 2:'被撤回的汇款信息', 1:'待审核汇款信息'}" name="approveState" cssStyle="width: 140px;"></s:select>
					</div>
					<div style="float: left; text-align: center;">
						<img alt="" src="${ctx }/images/savemoney.gif" style="text-align: justify; border: 0" />
						&nbsp;
						<input type="button" id="btnPass" style="cursor: hand" value="通过审核" />
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<input type="button" id="btnUntread" style="cursor: hand; width: 68px;" value="撤回汇款" />
					</div>
				</div>

				<div style="width: 100%; background-color: #FBF7E6; text-align: center;">
					<table cellspacing="2" cellpadding="3" border="1" style="background-color:#FFF7E7;border-color:#DEBA84;border-width:1px;border-style:None;width:99%;">
						<thead>
							<tr style="color:White;background-color:#A55129;font-weight:bold; font-size: 11px;">
								<th>选定（√）</th>
								<th>用户名</th>
								<th>金额(元)</th>
								<th>汇款时间</th>
								<th>审核状态</th>
								<th>汇款详情</th>
							</tr>
						</thead>
						<tbody>
							<s:if test="page.data.size() == 0">
								<tr style="color:#000066;background-color:#FFF7E7; font-size: 13px; text-align: center;">
									<td colspan="6">暂无汇款记录！</td>
								</tr>
							</s:if>
							<s:else>
								<s:iterator value="page.data">
									<tr style="color:#000066;background-color:#FFF7E7; font-size: 13px; text-align: center;">
										<td>
											<input type="checkbox" name="postids" value='<s:property value="historyId" />' />
										</td>
										<td>
											<s:property value="username" />
										</td>
										<td>
											<s:property value="money" />
										</td>
										<td>
											<s:property value="postTime" />
										</td>
										<td>
											<s:property value="approveState" />
										</td>
										<td>
											<span style="color:blue;">
												<a href="#" onclick="viewPostDetail('<s:property value="historyId" />');">查看详细</a>
											</span>
										</td>
									</tr>
								</s:iterator>
							</s:else>
						</tbody>
						<tfoot>
							<tr>
								<td colspan="6" align="center">
									<gc:page pageSize="${page.pageSize}" 
										totalCount="${page.totalCount}" 
										formId="form1" 
										totalPageCount="${page.totalPageCount}" 
										currentPageNo="${page.currentPageNo}" />
								</td>
							</tr>
						</tfoot>
					</table>
				</div>
				<div style="width: 100%; height: 10px; background-color: #FBF7E6"></div>
				<div style="width: 100%;">
					<div style="float: left; width: 30%">
						&nbsp;&nbsp;
						<input type="button" id="btnDelete" style="cursor: hand; height: 22px; width: 82px;" value="删除选定记录" />
					</div>
					<div style="float: left; width: 50%"></div>
				</div>
			</div>
		</s:form>
	</body>
</html>
